<template>
  <div>
    <CommonContainer title="客户信息">
      <template v-slot:leftInfo>
        <div v-if="customerInfo.prompt" class="applyRemindBox flex-row-center"><i class="el-icon-warning" style="color: #F5222D;margin-right: 4px"></i> {{ customerInfo.prompt }}
        </div>
      </template>
      <template v-slot:rightInfo>
        <div class="rightInfo" @click="goHistoryCreditRecord">查看客户历史信审记录</div>
      </template>
      <el-descriptions>
        <el-descriptions-item label="客户名称">{{ customerInfo.customerName|filterNull }}</el-descriptions-item>
        <el-descriptions-item label="客户编号">{{ customerInfo.customerCode|filterNull }}</el-descriptions-item>
        <el-descriptions-item label="联系方式">{{ customerInfo.contactInformation|filterNull }}</el-descriptions-item>
        <template v-if="customerInfo.customerType==1">
          <el-descriptions-item label="证件类型">
            <dict-tag
                :options="dict.type.identity_type"
                :value="customerInfo.documentType"/>
          </el-descriptions-item>
          <el-descriptions-item label="证件号码">{{ customerInfo.identificationNumber|filterNull }}</el-descriptions-item>
          <el-descriptions-item label="客户职业">{{ customerInfo.customerOccupation|filterNull }}</el-descriptions-item>
          <el-descriptions-item label="客户职务">{{ customerInfo.customerPosition|filterNull }}</el-descriptions-item>
          <el-descriptions-item label="客户住址">{{ customerInfo.customerAddress|filterNull }}</el-descriptions-item>
          <el-descriptions-item label="客户工作单位">{{ customerInfo.customerWorkUnit|filterNull }}</el-descriptions-item>
          <el-descriptions-item label="婚姻状况">
            <dict-tag
                :options="dict.type.marital_status"
                :value="customerInfo.maritalStatus"/>
          </el-descriptions-item>
        </template>
        <template v-else-if="customerInfo.customerType==2">
          <el-descriptions-item label="统一社会信用代码">{{ customerInfo.identificationNumber|filterNull }}</el-descriptions-item>
          <el-descriptions-item label="主营业务">{{ customerInfo.mainBusiness|filterNull }}</el-descriptions-item>
          <el-descriptions-item label="经营地址">{{ customerInfo.customerAddress|filterNull }}</el-descriptions-item>
        </template>

        <el-descriptions-item label="客户类型">
          <dict-tag
              :options="dict.type.customer_type"
              :value="customerInfo.customerType"/>
        </el-descriptions-item>
        <el-descriptions-item label="客户标签">
          <dict-tag
              :options="dict.type.customer_label"
              :value="customerInfo.customerSource"/>
        </el-descriptions-item>
        <el-descriptions-item label="客户等级">
          <dict-tag
              :options="dict.type.customer_level"
              :value="customerInfo.customerLevel"/>
        </el-descriptions-item>
        <el-descriptions-item label="客户属性">
          <dict-tag
              :options="dict.type.customer_property"
              :value="customerInfo.clientProperty"/>
        </el-descriptions-item>
        <el-descriptions-item label="是否老客户">
          <dict-tag
              :options="dict.type.business_yes_no"
              :value="customerInfo.areYouALoyalCustomer"/>
        </el-descriptions-item>
        <el-descriptions-item label="联系人1">{{ customerInfo.primaryContact|filterNull }}</el-descriptions-item>
        <el-descriptions-item label="联系人1联系方式">{{ customerInfo.primaryContactPhone|filterNull }}</el-descriptions-item>
        <el-descriptions-item label="联系人1与客户关系">{{ customerInfo.primaryContactWorkDuties|filterNull }}</el-descriptions-item>
        <el-descriptions-item label="联系人2">{{ customerInfo.secondaryContact|filterNull }}</el-descriptions-item>
        <el-descriptions-item label="联系人2联系方式">{{ customerInfo.secondaryContactPhone|filterNull }}</el-descriptions-item>
        <el-descriptions-item label="联系人2与客户关系">{{ customerInfo.secondaryContactIdentity|filterNull }}</el-descriptions-item>
<!--        <el-descriptions-item label="信审编号">{{ applicationNo|filterNull }}</el-descriptions-item>-->
      </el-descriptions>
    </CommonContainer>
    <history-credit-record ref="historyCreditRecord2"></history-credit-record>
  </div>

</template>

<script>
import HistoryCreditRecord from "@/views/letterReview/letterReview/components/HistoryCreditRecord.vue";

export default {
  dicts: ['customer_type', 'business_yes_no', 'customer_level', 'customer_property', 'customer_label', 'identity_type', 'marital_status'],
  components: {HistoryCreditRecord},
  props: {
    customerInfo: {
      type: Object,
      default: () => {
        return {}
      }
    },
    applicationNo: {
      type: String,
      default: ''
    }
  },
  data() {
    // 这里存放数据
    return {}
  },
  // 计算属性 类似于 data 概念
  computed: {},
  // 方法集合
  methods: {
    goHistoryCreditRecord() {
      this.$refs.historyCreditRecord2.show(this.customerInfo.customerNo)
    },
  },
  // 生命周期 - 创建完成（可以访问当前this 实例）
  created() {
  },
  // 生命周期 - 挂载完成（可以访问 DOM 元素）
  mounted() {
  },

}
</script>

<style lang="scss" scoped>
.applyRemindBox {
  box-sizing: border-box;
  text-align: center;
  background: #FFF1F0;
  border-radius: 4px;
  border: 1px solid #FFCCC7;
  font-size: 14px;
  font-weight: 400;
  color: #464646;
  padding: 8px 12px;
}

.rightInfo {
  font-size: 14px;
  color: #1890FF;
}

</style>
